<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>if&&switch语句</title>
</head>

<body>
    <script>
        //if语句
        let month = 3;
        if (month >= 3 && month <= 5) {
            document.write("春季");
        } else if (month >= 6 && month <= 8) {
            document.write("夏季");
        } else if (month >= 9 && month <= 11) {
            document.write("秋季");
        } else if (month == 12 || month == 1 || month == 2) {
            document.write("冬季");
        } else {
            document.write("月份有误");
        }

        document.write("<br>");

        //switch语句
        switch (month) {
            case 3:
            case 4:
            case 5:
                document.write("春季");
                break;
            case 6:
            case 7:
            case 8:
                document.write("夏季");
                break;
            case 9:
            case 10:
            case 11:
                document.write("秋季");
                break;
            case 12:
            case 1:
            case 2:
                document.write("冬季");
                break;
            default:
                document.write("月份有误");
                break;
        }

        document.write("<br>");

        //for循环
        for (let i = 1; i <= 5; i++) {
            document.write(i + "<br>");
        }

        //while循环
        let n = 6;
        while (n <= 10) {
            document.write(n + "<br>");
            n++;
        }
    </script>
</body>

</html>